//
//  Line.swift
//  ImGuider X
//
//  Created by llt on 2018/9/14.
//  Copyright © 2018年 imguider. All rights reserved.
//

import UIKit

//1城市导览，2模版景点，3自定义景点，4专题

/// 线路类型
///
/// - citytour: 城市导览
/// - modeview: 模版景点
/// - customview: 自定义景点
/// - special: 专题
enum LineType:String,Codable {
    
    case citytour = "1"
    case modeview = "2"
    case customview = "3"
    case special = "4"
}


///  交通方式
///
/// - normal: 默认为步行
/// - foot: 步行
/// - bus: 巴士
/// - ship: 轮船
/// - car: 自驾
enum TransportType:Int,Codable {
    
    case normal = 0
    case foot = 1
    case bus = 2
    case ship = 3
    case car = 4
}

class Line: NSObject,Codable {

    var viewName,cityName,city,country:String?
    var lineid,unionid,pictures,playpath,linename,linedesc,price,timelabel,audiopic,labels,maps:String?
    var recordcount,visits:Int?
    var transport:TransportType?
    var bought:Bool = false// 是否购买
    var hascode,cansearch, hasmap, inroom : Bool?// 是否有官方编号
    
    var type:LineType?
    
    var guide:Guide?
    var records:[Record]?
    
    var linepics:[String]?
    
    var pictureArray:[String]? {
        
        return pictures?.components(separatedBy: ",").compactMap({ str -> String? in
            
            return str.count > 0 ? str : nil
        })
    }
    
    var mapPicArray:[String]? {
        
        return maps?.components(separatedBy: ",").compactMap({ str -> String? in
            
            return str.count > 0 ? str : nil
        })
    }
}
